/*
 * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HTTP_DEF_H
#define HTTP_DEF_H

#include "hi_ext_def.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
    常用http header name定义.
*/
#define HH_CONTENT_TYPE         "content-type"
#define HH_ACCEPT               "accept" // req only
#define HH_CONTENT_LENGTH       "content-length"
#define HH_METHOD               ":method"
#define HH_SCHEME               ":scheme"
#define HH_AUTHORITY            ":authority"
#define HH_HOST                 ":host"
#define HH_PATH                 ":path"
#define HH_STATUS               ":status" // rsp only
#define HH_LAST_EVT_ID          "last-event-id" // for SSE

/**
    常用http status (response code)定义.
*/
#define HRSP_OK                 200

/**
    http method.
*/
#define HM_GET                  "GET"
#define HM_HEAD                 "HEAD"
#define HM_PUT                  "PUT"
#define HM_POST                 "POST"

/**
    http method code (uint32_t).
*/
#define HMC_ALL                 0xFFFFFFFF
#define HMC_GET                 HI_BIT0
#define HMC_HEAD                HI_BIT1
#define HMC_PUT                 HI_BIT4
#define HMC_POST                HI_BIT5

/**
    公知的content-type.
*/
#define HCT_RAPI                "application/json"
#define HCT_SSE                 "text/event-stream"

/**
    杂项常量.
*/
#define HTTP_METHOD_MAX         16 // method string buf max

#ifdef __cplusplus
}
#endif

#endif // HTTP_DEF_H
